package com.csii.pos.uofplan.service.Impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.csii.pos.uofplan.UofPlanPo;
import com.csii.pos.uofplan.mapper.UofPlanMapper;
import com.csii.pos.uofplan.service.PositionPlanQueryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import javax.annotation.Resource;
import java.util.List;

/**
 * @description:
 * @author:
 * @create:
 */
@Service("PositionPlanQueryService")
@Slf4j
public class PositionPlanQueryServiceImpl implements PositionPlanQueryService {
    @Resource
    private UofPlanMapper uofPlanMapper;
    @Override
    public IPage<UofPlanPo> positionPlanQuery(Page<UofPlanPo> page, UofPlanPo uofPlanPo) {
        String uofPlanItlNo = uofPlanPo.getUofPlanItlNo();
        String uofPlanDt = uofPlanPo.getUofPlanDt();
        IPage<UofPlanPo> iPage = uofPlanMapper.PositionPlanQuery(page,uofPlanDt,uofPlanItlNo);
        IPage<UofPlanPo> iPage1 = change(iPage);
        return iPage1;
    }
    /**
     * @description:  将审批结果转化为中文
     * @param: iPage
     * @return: iPage
     * @author
     * @date:
     */
    private IPage<UofPlanPo> change(IPage<UofPlanPo> iPage){

//        for (UofPlanPo records:iPage.getRecords()) {
//            if (StringUtils.isEmpty(records.getBusnAgrtRstChange())){
//                records.setBusnAgrtRst("未审批");
//            }else if ("0".equals(records.getBusnAgrtRstChange())){
//                records.setBusnAgrtRst("驳回");
//            }else if ("1".equals(records.getBusnAgrtRstChange())){
//                records.setBusnAgrtRst("同意");
//            }
//        }
        return iPage;
    }
}
